package com.sc.test.volley;

import android.graphics.Bitmap;
import android.util.LruCache;

import com.android.volley.toolbox.ImageLoader;

/**
 * Created by Shen Chao.
 * Created on 2018-06-04-004.
 */

public class BitMapCache implements ImageLoader.ImageCache {
    private LruCache<String, Bitmap> mCache;

    public BitMapCache() {
        int maxSize = 1024 * 1024 * 10;
        mCache = new LruCache<>(maxSize);
    }

    @Override
    public Bitmap getBitmap(String url) {
        return mCache.get(url);
    }

    @Override
    public void putBitmap(String url, Bitmap bitmap) {
        mCache.put(url, bitmap);
    }
}
